package com.hd.hdxgddcommon.constant;

import java.lang.reflect.Field;

public interface BaseConstant {

    String DEFAULT_ORG_ID = "0000000000";

    interface TIME_TYPE {
        int DAY = 5;
        int MONTH = 2;
        int YEAR = 1;
    }

    interface DELETE_STATE {
        int UN_DELETE = 1;
        int DELETE = 2;
    }

    interface IS_SHOW {
        int SHOW = 1;
        int HIDE = 0;
    }

    interface GENDER {
        int MALE = 1;
        int FEMALE = 2;
        int OTHER = 3;
    }

    static boolean validate(Class clazz, Object val) {
        if (val == null) return false;
        Field[] fields = clazz.getFields();
        for (Field field : fields) {
            try {
                Object o = field.get(clazz);
                if (o.equals(val)) return true;
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
        return false;
    }
}
